/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-08-05
 * Time:21:16
 */
public class Main {
    public static void main(String[] args) {
        int a=1;
        int b=2;
        int c=3;
        System.out.println(a==b);
        System.out.println(b==c);
        String s1=new String("hello");
        String s2=new String("hello");
        String s3=new String("world");
        String s4=s1;
        System.out.println(s1==s2);//false
        System.out.println(s2==s3);//false
        System.out.println(s1==s4);//true
        System.out.println(s1.equals(s2));
    }
    public static void main1(String[] args) {
        //使用常量串构造
        String s1="hello";
        System.out.println(s1);
        //直接newString对象
        String s2=new String("hello");
        System.out.println(s2);
        //使用字符数组进行构造
        char[] array={'h','e','l','l','o'};
        String s3=new String(array);
        System.out.println(s3);
    }
}
